package com.neuedu.hisadmin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neuedu.hisadmin.entity.User;
import com.neuedu.hisadmin.mapper.UserMapper;
import com.neuedu.hisadmin.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jaun
 * @since 2025-07-05
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Override
    public User login(String username, String password) {
        // 创建 QueryWrapper 对象
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();

        // 设置查询条件
        queryWrapper.eq("UserName", username)
                .eq("Password", password)
                .eq("DelMark", 1); // 只查询未删除的用户

        // 执行查询
        return this.getOne(queryWrapper);
    }
}
